Skip to content

refactor: remove deprecated AI use case and update related components#1746

Merged
Artuomka merged 1 commit into
mainfrom
backend_remove_open_ai
Apr 29, 2026
Merged

refactor: remove deprecated AI use case and update related components#1746
Artuomka merged 1 commit into
mainfrom
backend_remove_open_ai

Conversation

@Artuomka
Copy link
Copy Markdown
Collaborator

@Artuomka Artuomka commented Apr 29, 2026

  • Deleted the old RequestInfoFromTableWithAIUseCaseV6 implementation.
  • Introduced RequestInfoFromTableWithAIUseCaseV7 with improved message handling and response processing.
  • Updated UserAIRequestsControllerV2 to remove references to older use cases and streamline AI request handling.
  • Adjusted schema change AI loop to remove unnecessary configuration handling.
  • Removed unused AI response entity from the user entity.
  • Updated various test files to switch the default AI provider from OpenAI to Bedrock.
  • Cleaned up package dependencies by removing unused OpenAI packages from pnpm-lock.yaml.

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Removed OpenAI as a supported AI provider; Bedrock is now the only available option.
    • Deprecated older AI request endpoints (v2, v3); migrate to the latest endpoint version.
  • Improvements

    • Simplified AI response handling and message persistence.
    • Updated default AI provider to Bedrock across all services and tests.

- Deleted the old `RequestInfoFromTableWithAIUseCaseV6` implementation.
- Introduced `RequestInfoFromTableWithAIUseCaseV7` with improved message handling and response processing.
- Updated `UserAIRequestsControllerV2` to remove references to older use cases and streamline AI request handling.
- Adjusted schema change AI loop to remove unnecessary configuration handling.
- Removed unused AI response entity from the user entity.
- Updated various test files to switch the default AI provider from OpenAI to Bedrock.
- Cleaned up package dependencies by removing unused OpenAI packages from `pnpm-lock.yaml`.
Copilot AI review requested due to automatic review settings April 29, 2026 11:12
@Artuomka Artuomka enabled auto-merge April 29, 2026 11:13
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

The PR removes complete OpenAI integration from the backend, including dependencies, provider implementation, data models, and multiple API versions. The system is refactored to support only Bedrock as the exclusive AI provider. Deprecated use cases (V2, V3, V5, V6) are deleted, and V7 is simplified to remove OpenAI-specific configuration handling.

Changes

Cohort / File(s) Summary
Dependencies & Module Registration
backend/package.json, backend/src/ai-core/ai-core.module.ts, backend/src/ai-core/providers/index.ts
Removed @langchain/openai and openai packages; removed LangchainOpenAIProvider from module exports and provider index re-exports.
AI Provider Interfaces
backend/src/ai-core/interfaces/ai-service.interface.ts, backend/src/ai-core/interfaces/ai-provider.interface.ts
Deleted OPENAI enum member from AIProviderType; removed previousResponseId property from AIProviderConfig.
OpenAI Provider Implementation
backend/src/ai-core/providers/langchain-openai.provider.ts
Deleted entire LangchainOpenAIProvider class (375 lines), including completion generation, streaming, tool handling, and response continuation methods.
AI Core Service
backend/src/ai-core/services/ai-core.service.ts
Removed LangchainOpenAIProvider injection; switched default provider from OpenAI to Bedrock; removed OpenAI handling from getProvider() switch and getAvailableProviders() list.
Database Context & Repositories
backend/src/common/application/global-database-context.interface.ts, backend/src/common/application/global-database-context.ts, backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/*
Removed aiResponsesToUserRepository property and initialization; deleted entire AiResponsesToUserEntity class (33 lines) and corresponding repository interface/extension.
Chat Message Repository
backend/src/entities/ai/ai-conversation-history/ai-chat-messages/ai-chat-message.entity.ts, backend/src/entities/ai/ai-conversation-history/ai-chat-messages/repository/ai-chat-message-repository.*
Removed response_id field from entity; removed findLastAiMessageForChat() method; simplified saveMessage() signature to remove optional responseId parameter.
Deprecated Use Cases
backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v5.use.case.ts, backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v6.use.case.ts
Deleted V5 (344 lines) and V6 (337 lines) use case implementations including SSE streaming, tool-loop execution, response persistence, and error handling.
Use Case Cleanup
backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v7.use.case.ts, backend/src/entities/ai/ai.module.ts, backend/src/entities/ai/user-ai-requests-v2.controller.ts
Simplified V7 to remove previousResponseId propagation and OpenAI-specific config handling; removed V2/V3 route handlers and use case injections (88 lines); removed V2/V3 middleware registration from AI module.
Configuration & Data Models
backend/src/common/data-injection.tokens.ts, backend/src/entities/table-schema/ai/run-schema-change-ai-loop.ts, backend/src/entities/user/user.entity.ts
Removed REQUEST_INFO_FROM_TABLE_WITH_AI_V2 and V3 enum members; changed config from let to const and removed previousResponseId updates in schema-change loop; removed ai_responses relation from UserEntity.
Test Mock Updates
backend/test/ava-tests/.../non-saas-ai-chat-e2e.test.ts, backend/test/ava-tests/.../non-saas-table-schema-*.test.ts, backend/test/ava-tests/saas-tests/ai-chat-e2e.test.ts
Updated mocked AICoreService.getDefaultProvider() to return 'bedrock' instead of 'openai' across 18 test files (1 line per file).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • lyubov-voloshko

Poem

🐰 Farewell, OpenAI's bright call,
We've cleared the clutter, removed it all!
Now Bedrock reigns, our sole provider true,
Simpler paths for streams to pass through.
The rabbit hops on, leaner and free! 🌿

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: removing deprecated AI use cases and updating related components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed Pull request follows OWASP security principles by maintaining SQL injection protections, authentication/authorization guards, access control checks, and proper error handling while removing deprecated code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backend_remove_open_ai

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (8)
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mysql-e2e.test.ts (1)

88-88: Please explicitly annotate the return type of getDefaultProvider.

This updated mock method should not rely on inferred return typing.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mysql-e2e.test.ts`
at line 88, The mock function getDefaultProvider should have an explicit return
type instead of relying on inference; update the mock definition
(getDefaultProvider: () => 'bedrock') to include a TypeScript return annotation
(e.g., getDefaultProvider: () => string or a narrower literal type) so the
function signature is explicitly typed according to the project's guidelines and
the testing code consuming getDefaultProvider uses the declared type.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-redis-e2e.test.ts (1)

60-60: Add an explicit return type to this mock method.

Please annotate the return type for getDefaultProvider explicitly to match the TypeScript rule used in this repo (e.g. (): string => 'bedrock').

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-redis-e2e.test.ts`
at line 60, The mock method getDefaultProvider currently lacks an explicit
return type; update its signature to include a return annotation (for example,
change to a function typed as (): string => 'bedrock') so TypeScript rule
enforcement for explicit return types is satisfied—locate the getDefaultProvider
mock in the test and add the : string return type to the arrow function.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mongodb-e2e.test.ts (1)

83-83: Add explicit return typing for this mock provider accessor.

Please avoid inferred return type here and annotate it directly.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mongodb-e2e.test.ts`
at line 83, The mock provider accessor getDefaultProvider currently relies on
type inference; add an explicit return type annotation (for example, change its
signature to getDefaultProvider: () => string) so the function's return type is
declared rather than inferred—update the getDefaultProvider property in the mock
to include the explicit return type.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-clickhouse-e2e.test.ts (1)

83-83: Please add a return type annotation on getDefaultProvider.

The updated mock function should be explicitly typed.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-clickhouse-e2e.test.ts`
at line 83, The mock function getDefaultProvider lacks an explicit return type;
update its signature to include a return type annotation (for example change
getDefaultProvider: () => 'bedrock' to getDefaultProvider: (): string =>
'bedrock' or to a more specific provider type/union if one exists in your
codebase), ensuring the function has an explicit return type per the project's
TypeScript guidelines.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-elasticsearch-e2e.test.ts (1)

83-83: Add an explicit return type for this updated mock function.

It should be typed explicitly rather than relying on inference.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-elasticsearch-e2e.test.ts`
at line 83, The mock function getDefaultProvider should have an explicit return
type instead of relying on inference; update the mocked implementation (the
getDefaultProvider arrow function) to declare its return type (e.g., : string or
a specific Provider type used in tests) so the function signature includes an
explicit return type annotation.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-oracle-e2e.test.ts (1)

84-84: Please annotate getDefaultProvider with an explicit return type.

This keeps the updated mock aligned with the repository TypeScript typing rule.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-oracle-e2e.test.ts`
at line 84, The mock function getDefaultProvider should have an explicit return
type to satisfy the TS rule; update the function signature for
getDefaultProvider to declare its return type (string) so the arrow function is
typed as returning string (i.e., annotate getDefaultProvider with a return type
instead of relying on inference).
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mssql-e2e.test.ts (1)

84-84: Add an explicit return type to this changed arrow function.

Typing this accessor explicitly keeps the test mock compliant with project TS rules.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mssql-e2e.test.ts`
at line 84, The getDefaultProvider arrow function in the test mock should have
an explicit return type to satisfy TypeScript rules; change the accessor
signature from getDefaultProvider: () => 'bedrock' to include a return type
(e.g., getDefaultProvider: (): string => 'bedrock') so the mock remains
correctly typed and compliant with the project's rule requiring explicit
function return annotations.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-cassandra-e2e.test.ts (1)

83-83: Please explicitly type the return value of getDefaultProvider.

This updated line should include an explicit return type annotation.

As per coding guidelines, **/*.{ts,tsx}: Always add type annotations to function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-cassandra-e2e.test.ts`
at line 83, Add an explicit return type to the getDefaultProvider arrow function
(the one currently defined as getDefaultProvider: () => 'bedrock') by annotating
its return type (e.g., : string or the literal type : 'bedrock') so the function
signature includes a clear TypeScript return type; update the getDefaultProvider
declaration accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-cassandra-e2e.test.ts`:
- Line 83: Add an explicit return type to the getDefaultProvider arrow function
(the one currently defined as getDefaultProvider: () => 'bedrock') by annotating
its return type (e.g., : string or the literal type : 'bedrock') so the function
signature includes a clear TypeScript return type; update the getDefaultProvider
declaration accordingly.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-clickhouse-e2e.test.ts`:
- Line 83: The mock function getDefaultProvider lacks an explicit return type;
update its signature to include a return type annotation (for example change
getDefaultProvider: () => 'bedrock' to getDefaultProvider: (): string =>
'bedrock' or to a more specific provider type/union if one exists in your
codebase), ensuring the function has an explicit return type per the project's
TypeScript guidelines.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-elasticsearch-e2e.test.ts`:
- Line 83: The mock function getDefaultProvider should have an explicit return
type instead of relying on inference; update the mocked implementation (the
getDefaultProvider arrow function) to declare its return type (e.g., : string or
a specific Provider type used in tests) so the function signature includes an
explicit return type annotation.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mongodb-e2e.test.ts`:
- Line 83: The mock provider accessor getDefaultProvider currently relies on
type inference; add an explicit return type annotation (for example, change its
signature to getDefaultProvider: () => string) so the function's return type is
declared rather than inferred—update the getDefaultProvider property in the mock
to include the explicit return type.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mssql-e2e.test.ts`:
- Line 84: The getDefaultProvider arrow function in the test mock should have an
explicit return type to satisfy TypeScript rules; change the accessor signature
from getDefaultProvider: () => 'bedrock' to include a return type (e.g.,
getDefaultProvider: (): string => 'bedrock') so the mock remains correctly typed
and compliant with the project's rule requiring explicit function return
annotations.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mysql-e2e.test.ts`:
- Line 88: The mock function getDefaultProvider should have an explicit return
type instead of relying on inference; update the mock definition
(getDefaultProvider: () => 'bedrock') to include a TypeScript return annotation
(e.g., getDefaultProvider: () => string or a narrower literal type) so the
function signature is explicitly typed according to the project's guidelines and
the testing code consuming getDefaultProvider uses the declared type.

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-oracle-e2e.test.ts`:
- Line 84: The mock function getDefaultProvider should have an explicit return
type to satisfy the TS rule; update the function signature for
getDefaultProvider to declare its return type (string) so the arrow function is
typed as returning string (i.e., annotate getDefaultProvider with a return type
instead of relying on inference).

In
`@backend/test/ava-tests/non-saas-tests/non-saas-table-schema-redis-e2e.test.ts`:
- Line 60: The mock method getDefaultProvider currently lacks an explicit return
type; update its signature to include a return annotation (for example, change
to a function typed as (): string => 'bedrock') so TypeScript rule enforcement
for explicit return types is satisfied—locate the getDefaultProvider mock in the
test and add the : string return type to the arrow function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5df323c-3784-4052-8eb6-e5f42e0b1e89

📥 Commits

Reviewing files that changed from the base of the PR and between 941ab40 and 2e6feab.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • backend/package.json
  • backend/src/ai-core/ai-core.module.ts
  • backend/src/ai-core/interfaces/ai-provider.interface.ts
  • backend/src/ai-core/interfaces/ai-service.interface.ts
  • backend/src/ai-core/providers/index.ts
  • backend/src/ai-core/providers/langchain-openai.provider.ts
  • backend/src/ai-core/services/ai-core.service.ts
  • backend/src/common/application/global-database-context.interface.ts
  • backend/src/common/application/global-database-context.ts
  • backend/src/common/data-injection.tokens.ts
  • backend/src/entities/ai/ai-conversation-history/ai-chat-messages/ai-chat-message.entity.ts
  • backend/src/entities/ai/ai-conversation-history/ai-chat-messages/repository/ai-chat-message-repository.extension.ts
  • backend/src/entities/ai/ai-conversation-history/ai-chat-messages/repository/ai-chat-message-repository.interface.ts
  • backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-reponses-to-user-repository.extension.ts
  • backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-responses-to-user-repository.interface.ts
  • backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-responses-to-user.entity.ts
  • backend/src/entities/ai/ai.module.ts
  • backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v5.use.case.ts
  • backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v6.use.case.ts
  • backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v7.use.case.ts
  • backend/src/entities/ai/user-ai-requests-v2.controller.ts
  • backend/src/entities/table-schema/ai/run-schema-change-ai-loop.ts
  • backend/src/entities/user/user.entity.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-ai-chat-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-cassandra-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-clickhouse-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-dynamodb-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-elasticsearch-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-ibmdb2-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mongodb-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mssql-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mysql-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-oracle-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-postgres-e2e.test.ts
  • backend/test/ava-tests/non-saas-tests/non-saas-table-schema-redis-e2e.test.ts
  • backend/test/ava-tests/saas-tests/ai-chat-e2e.test.ts
💤 Files with no reviewable changes (17)
  • backend/package.json
  • backend/src/ai-core/providers/index.ts
  • backend/src/ai-core/interfaces/ai-provider.interface.ts
  • backend/src/entities/ai/ai-conversation-history/ai-chat-messages/ai-chat-message.entity.ts
  • backend/src/common/data-injection.tokens.ts
  • backend/src/common/application/global-database-context.interface.ts
  • backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-responses-to-user.entity.ts
  • backend/src/ai-core/interfaces/ai-service.interface.ts
  • backend/src/entities/user/user.entity.ts
  • backend/src/common/application/global-database-context.ts
  • backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-reponses-to-user-repository.extension.ts
  • backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-responses-to-user-repository.interface.ts
  • backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v6.use.case.ts
  • backend/src/entities/ai/user-ai-requests-v2.controller.ts
  • backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v5.use.case.ts
  • backend/src/ai-core/providers/langchain-openai.provider.ts
  • backend/src/entities/ai/ai.module.ts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the backend AI integration by removing deprecated OpenAI-based use cases/providers and consolidating “request info from table” functionality around the Bedrock-backed V7/V4 path, along with related entity/repository cleanup and test updates.

Changes:

  • Removed OpenAI provider support (provider implementation, enum value, dependencies) and deprecated AI request endpoints/use cases (V2/V3, V5/V6).
  • Simplified AI tool-loop/config handling (dropped previousResponseId plumbing) and removed the deprecated ai_responses_to_user persistence layer.
  • Updated AVA E2E tests to use Bedrock as the default AI provider.

Reviewed changes

Copilot reviewed 36 out of 37 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pnpm-lock.yaml Removes OpenAI-related lock entries and adjusts dependency graph.
backend/package.json Drops openai and @langchain/openai direct dependencies.
backend/test/ava-tests/saas-tests/ai-chat-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-ai-chat-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-redis-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-postgres-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-oracle-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mysql-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mssql-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-mongodb-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-ibmdb2-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-elasticsearch-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-dynamodb-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-clickhouse-e2e.test.ts Updates mocked default provider to Bedrock.
backend/test/ava-tests/non-saas-tests/non-saas-table-schema-cassandra-e2e.test.ts Updates mocked default provider to Bedrock.
backend/src/ai-core/ai-core.module.ts Removes OpenAI provider wiring/exports from the AI core module.
backend/src/ai-core/interfaces/ai-provider.interface.ts Removes OpenAI-specific previousResponseId config field.
backend/src/ai-core/interfaces/ai-service.interface.ts Removes OPENAI from AIProviderType.
backend/src/ai-core/providers/index.ts Stops exporting the OpenAI provider.
backend/src/ai-core/providers/langchain-openai.provider.ts Removes OpenAI provider implementation.
backend/src/ai-core/services/ai-core.service.ts Makes Bedrock the only/default provider; removes OpenAI provider usage and availability.
backend/src/common/application/global-database-context.interface.ts Removes aiResponsesToUserRepository from the global DB context interface.
backend/src/common/application/global-database-context.ts Removes aiResponsesToUserRepository wiring from the global DB context implementation.
backend/src/common/data-injection.tokens.ts Removes deprecated use-case tokens for V2/V3.
backend/src/entities/ai/ai-conversation-history/ai-chat-messages/ai-chat-message.entity.ts Removes response_id column from chat message entity.
backend/src/entities/ai/ai-conversation-history/ai-chat-messages/repository/ai-chat-message-repository.interface.ts Removes findLastAiMessageForChat and drops responseId from saveMessage signature.
backend/src/entities/ai/ai-conversation-history/ai-chat-messages/repository/ai-chat-message-repository.extension.ts Removes findLastAiMessageForChat implementation and stops persisting response_id.
backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-responses-to-user.entity.ts Removes deprecated ai_responses_to_user entity.
backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-responses-to-user-repository.interface.ts Removes deprecated repository interface.
backend/src/entities/ai/ai-data-entities/ai-reponses-to-user/ai-reponses-to-user-repository.extension.ts Removes deprecated repository extension.
backend/src/entities/ai/ai.module.ts Removes V2/V3 wiring and routes; maps V4 to the V7 use case.
backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v5.use.case.ts Deletes deprecated V5 implementation.
backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v6.use.case.ts Deletes deprecated V6 implementation.
backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v7.use.case.ts Simplifies tool-loop/config handling and message history building for Bedrock-only flow.
backend/src/entities/ai/user-ai-requests-v2.controller.ts Removes V2/V3 endpoints; keeps V4 endpoint.
backend/src/entities/table-schema/ai/run-schema-change-ai-loop.ts Removes OpenAI-only config continuation logic.
backend/src/entities/user/user.entity.ts Removes deprecated ai_responses relation from the user entity.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -149,24 +136,16 @@ export class RequestInfoFromTableWithAIUseCaseV7
inputTableName: string,
userEmail: string,
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userEmail is typed as string here, but setupConnection() only assigns it for agent connections (otherwise it can be undefined). This can lead to undefined being forwarded into DAO calls at runtime. Consider making this parameter string | undefined (and updating the return type from setupConnection() accordingly), or always initializing userEmail to a defined value.

Suggested change
userEmail: string,
userEmail: string | undefined,

Copilot uses AI. Check for mistakes.
Comment on lines 399 to 400
builder.human(userMessage);

Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builder.human(userMessage) risks duplicating the latest user message for existing chats because the message is persisted before this method runs, and findMessagesForChat(chatId) will include it. This will cause the model to see the same user prompt twice. One fix is to build the prompt from history before saving the new user message, or to omit re-appending userMessage when it is already present in previousMessages.

Suggested change
builder.human(userMessage);
const lastMessage = previousMessages[previousMessages.length - 1];
const latestUserMessageAlreadyIncluded =
lastMessage?.role === MessageRole.user && lastMessage.message === userMessage;
if (!latestUserMessageAlreadyIncluded) {
builder.human(userMessage);
}

Copilot uses AI. Check for mistakes.
@@ -22,9 +22,6 @@ export class AiChatMessageEntity {
@Column({ nullable: true, default: null, type: 'enum', enum: MessageRole })
role: MessageRole;

Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entity no longer includes response_id, but there is an existing migration that adds the response_id column to ai_chat_message (and nothing in this PR drops it). If the column is truly deprecated, consider adding a follow-up migration to drop it to avoid leaving unused schema behind and to keep migrations aligned with the current entity model.

Suggested change
@Column({ nullable: true, default: null })
response_id: string;

Copilot uses AI. Check for mistakes.
Comment on lines 146 to 151
private _companyFaviconRepository: Repository<CompanyFaviconEntity>;
private _companyTabTitleRepository: Repository<CompanyTabTitleEntity>;
private _tableFiltersRepository: Repository<TableFiltersEntity> & ITableFiltersCustomRepository;
private _aiResponsesToUserRepository: Repository<AiResponsesToUserEntity> & IAiResponsesToUserRepository;
private _tableCategoriesRepository: Repository<TableCategoriesEntity> & ITableCategoriesCustomRepository;
private _userSecretRepository: Repository<UserSecretEntity> & IUserSecretRepository;
private _secretAccessLogRepository: Repository<SecretAccessLogEntity> & ISecretAccessLogRepository;
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AiResponsesToUserEntity + repository were removed from the codebase, but the historical migration that creates the ai_responses_to_user table still exists (so new environments will still create the table). If this table is now permanently unused, consider adding a migration to drop it (or otherwise documenting why it remains) to prevent accumulating unused schema over time.

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka merged commit 85b43b0 into main Apr 29, 2026
22 of 23 checks passed
@Artuomka Artuomka deleted the backend_remove_open_ai branch April 29, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants